package com.kws.merchant.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.kws.merchant.domain.ItemPlanFile;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kws.merchant.mapper.ItemPlanFileMapper;
import com.kws.merchant.service.ItemPlanFileService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;

/**
 * 报价-项目进度文件(ItemPlanFile)表服务实现类
 *
 * @author yxy
 * @since 2024-10-24 14:47:01
 */
@Service("itemPlanFileService")
public class ItemPlanFileServiceImpl extends ServiceImpl<ItemPlanFileMapper, ItemPlanFile> implements ItemPlanFileService {

    @Resource
    private ItemPlanFileMapper itemPlanFileMapper;


    /**
     * 分页查询列表
     */
    @Override
    public Page<ItemPlanFile> pageList(ItemPlanFile itemPlanFile) {
        Page<ItemPlanFile> page = new Page<>(0, 10);
        LambdaQueryWrapper<ItemPlanFile> queryWrapper = Wrappers.<ItemPlanFile>lambdaQuery();

        return this.page(page, queryWrapper);
    }

    /**
     * 根据项目id获取所有项目阶段数据
     * @param id
     * @return
     */
    @Override
    public List<ItemPlanFile> listByPlanId(Long id) {
        return this.list(Wrappers.<ItemPlanFile>lambdaQuery().eq(ItemPlanFile::getItemPlanId,id));
    }

    /**
     * 根据项目id和阶段删除文件
     * @param id
     * @return
     */
    @Override
    public Object removeByIdAndStatus(Long id) {
        return this.remove(Wrappers.<ItemPlanFile>lambdaQuery().eq(ItemPlanFile::getId,id));
    }

    /**
     * 根据项目进度id和状态查询进度文件
     * @param id
     * @param status
     * @return
     */
    @Override
    public List<ItemPlanFile> listByPlanIdAndStatus(Long id, Integer status) {
        return itemPlanFileMapper.listByPlanIdAndStatus(id,status);
    }


}
